import {useState,useEffect,useCallback} from "react"

const useSetSize = (props:string) =>{
    const [size,setSize] = useState({
        width:document.documentElement.clientWidth,
        height:document.documentElement.clientHeight
    })
    useEffect(()=>{
        window.addEventListener("resize",onSize)
        return () => {
            window.removeEventListener("resize",onSize)
        }
    },[])

    const onSize = useCallback(()=>{
        setSize({
            width:document.documentElement.clientWidth,
            height:document.documentElement.clientHeight
        })
    },[])
    return size
}
export default useSetSize